package com.uzai.common.enums.mini;

import java.util.Objects;

/**
 * The enum Mini order status.
 *
 * @author mingyang.chen create in 2023/11/1 17:09
 */
public enum MiniTradeType {

    /**
     * 付款
     */
    PAY(1),
    /**
     * 退款
     */
    REFUND(2),
    ;

    private final Integer code;

    MiniTradeType(Integer code) {
        this.code = code;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public Integer getCode() {
        return code;
    }

    public static MiniTradeType getByCode(Integer code) {
        for (MiniTradeType value : MiniTradeType.values()) {
            if (Objects.equals(value.code, code)) {
                return value;
            }
        }
        return null;
    }
}
